/* Gtkmm plugin */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "open_panels.hh"

#include <vlc/vlc.h>

#include <gtkmm/alignment.h>
#include <gtkmm/combobox.h>
#include <gtkmm/entry.h>
#include <gtkmm/filechooserwidget.h>
#include <gtkmm/filefilter.h>
#include <gtkmm/label.h>
#include <gtkmm/stock.h>

#include "util/string.hh"

FileOpenPanel::FileOpenPanel ()
{

  set_border_width (4);

  Gtk::FileChooserWidget *fc = new Gtk::FileChooserWidget ();
  fc->set_size_request (400, 300);
  fc->set_select_multiple (true);
  fc->show ();
  pack_start (*Gtk::manage (fc));

  Gtk::FileFilter *filter = new Gtk::FileFilter ();
  filter->set_name (_("Media Files"));
  fc->add_filter (*filter);

  filter = new Gtk::FileFilter ();
  filter->set_name (_("Video Files"));
  fc->add_filter (*filter);

  filter = new Gtk::FileFilter ();
  filter->set_name (_("Audio Files"));
  fc->add_filter (*filter);

  filter = new Gtk::FileFilter ();
  filter->set_name (_("Playlist Files"));
  fc->add_filter (*filter);

  filter = new Gtk::FileFilter ();
  filter->set_name (_("All Files"));
  fc->add_filter (*filter);

  Gtk::HBox *hbox = new Gtk::HBox (false, 4);

  hbox->pack_start (*new Gtk::Label (_("File names:")), false, false);

  Gtk::Entry *entry = new Gtk::Entry ();
  entry->set_editable (false);
  hbox->pack_start (*Gtk::manage (entry));

  pack_start (*Gtk::manage (hbox), false, false, 4);

  hbox->show_all ();

  m_sub_title = new SubTitleBox::SubTitleBox ();
  m_sub_title->show ();
  pack_start (*Gtk::manage (m_sub_title), false, false, 8);

  show ();

}

FileOpenPanel::~FileOpenPanel ()
{}

SubTitleBox::SubTitleBox ()
{

  m_check_button = new Gtk::CheckButton (q2gm ("Use a sub&titles file"), true);
  m_check_button->show ();
  m_check_button->signal_toggled ().connect (sigc::mem_fun (this, &SubTitleBox::view_box));

  Gtk::HBox *hbox = new Gtk::HBox (false, 4);
  Gtk::VBox *vbox = new Gtk::VBox (false, 4);

  vbox->set_border_width (8);

  Gtk::Entry *entry = new Gtk::Entry ();
  Gtk::Button *button = new Gtk::Button (Gtk::Stock::OPEN);

  hbox->pack_start (*Gtk::manage (entry), true, true);
  hbox->pack_start (*Gtk::manage (button), false, false);

  vbox->pack_start (*Gtk::manage (hbox));

  hbox = new Gtk::HBox (false, 4);

  /* Size and Align combobox data is set from VLC api
   * setfillVLCConfigCombo : modules/gui/qt4/components/preferences_widgets.cpp
   * for exemple
   */ 

  Gtk::ComboBox *combo_box = new Gtk::ComboBox ();

  Gtk::Label *label = new Gtk::Label (_("Size:")); 
  label->set_alignment (1.0, 0.5);

  hbox->pack_start (*Gtk::manage (label), false, false);
  hbox->pack_start (*Gtk::manage (combo_box), false, false);

  combo_box = new Gtk::ComboBox ();

  label = new Gtk::Label (_("Alignment:"));
  label->set_alignment (1.0, 0.5);

  hbox->pack_start (*Gtk::manage (new Gtk::Alignment ()), false, false, 20);

  hbox->pack_start (*Gtk::manage (label), false, false);
  hbox->pack_start (*Gtk::manage (combo_box), false, false);
  
  vbox->pack_start (*Gtk::manage (hbox));

  m_sub_title_frame = new Gtk::Frame ();
  m_sub_title_frame->add (*Gtk::manage (vbox));

  pack_start (*m_check_button);
  pack_start (*m_sub_title_frame);
  
  show ();

}

SubTitleBox::~SubTitleBox ()
{}

